/*
 * CompositeException.h
 *
 *  Created on: Dec 14, 2010
 *      Author: dhovemey
 */

#ifndef COMPOSITEEXCEPTION_H_
#define COMPOSITEEXCEPTION_H_

#include <vector>
#include "util/Exception.h"

class CompositeException : public Exception {
public:
	typedef std::vector<Exception *> ExceptionList;

	typedef ExceptionList::const_iterator const_iterator;
	typedef ExceptionList::size_type size_type;

private:
	ExceptionList m_exceptionList;

	CompositeException(const CompositeException &);
	CompositeException& operator=(const CompositeException &);

public:
	CompositeException();
	virtual ~CompositeException();

	void addAndAdopt(Exception *ex);

	size_type size() const { return m_exceptionList.size(); }
	const_iterator begin() const { return m_exceptionList.begin(); }
	const_iterator end() const { return m_exceptionList.end(); }
};

#endif /* COMPOSITEEXCEPTION_H_ */
